<html>
<head><meta charset="utf-8"><title>Read incremental files on-demand #83036 · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Read.20incremental.20files.20on-demand.20.2383036.html">Read incremental files on-demand #83036</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="230554568"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Read%20incremental%20files%20on-demand%20%2383036/near/230554568" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cjgillot <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Read.20incremental.20files.20on-demand.20.2383036.html#230554568">(Mar 16 2021 at 17:18)</a>:</h4>
<p><span class="user-mention" data-user-id="239881">@Josh Triplett</span> I tried using <code>BufRead</code>, but I could not implement <code>read_for_leb128</code>. Is there a way to ask to fill the buffer further when it is not empty? I'd be happy to get rid of the custom implementation to avoid the bugs.</p>



<a name="230562830"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Read%20incremental%20files%20on-demand%20%2383036/near/230562830" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Read.20incremental.20files.20on-demand.20.2383036.html#230562830">(Mar 16 2021 at 18:04)</a>:</h4>
<p>Huh. For some reason I <em>thought</em> there was a way to get more data into the buffer, but apparently not. :(</p>



<a name="230562957"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Read%20incremental%20files%20on-demand%20%2383036/near/230562957" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Read.20incremental.20files.20on-demand.20.2383036.html#230562957">(Mar 16 2021 at 18:04)</a>:</h4>
<p>That's unfortunate.</p>



<a name="230563007"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Read%20incremental%20files%20on-demand%20%2383036/near/230563007" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Read.20incremental.20files.20on-demand.20.2383036.html#230563007">(Mar 16 2021 at 18:05)</a>:</h4>
<p>Perhaps it would make sense to add such a function to <code>BufRead</code>?</p>



<a name="230563058"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Read%20incremental%20files%20on-demand%20%2383036/near/230563058" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Read.20incremental.20files.20on-demand.20.2383036.html#230563058">(Mar 16 2021 at 18:05)</a>:</h4>
<p>Er, to BufReader rather.</p>



<a name="230563105"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Read%20incremental%20files%20on-demand%20%2383036/near/230563105" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cjgillot <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Read.20incremental.20files.20on-demand.20.2383036.html#230563105">(Mar 16 2021 at 18:05)</a>:</h4>
<p>There is <code>fill_buf</code>, but its a no-op when there is still some data to the buffer.</p>



<a name="230563240"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Read%20incremental%20files%20on-demand%20%2383036/near/230563240" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cjgillot <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Read.20incremental.20files.20on-demand.20.2383036.html#230563240">(Mar 16 2021 at 18:06)</a>:</h4>
<p>We could remove this case to read more data in all cases.</p>



<a name="230572897"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Read%20incremental%20files%20on-demand%20%2383036/near/230572897" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cjgillot <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Read.20incremental.20files.20on-demand.20.2383036.html#230572897">(Mar 16 2021 at 19:10)</a>:</h4>
<p>Filed <a href="https://github.com/rust-lang/rust/issues/83212">#83212</a>.</p>



<a name="230818608"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Read%20incremental%20files%20on-demand%20%2383036/near/230818608" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Read.20incremental.20files.20on-demand.20.2383036.html#230818608">(Mar 18 2021 at 06:23)</a>:</h4>
<p><span class="user-mention" data-user-id="248906">@cjgillot</span> What about adding another function serving that purpose?</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>